package com.fz.jdbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class AppjdbcSelect {
    public static void main(String[] args) throws  Exception {
        Class.forName("com.mysql.jdbc.Driver");
        String url="jdbc:mysql://localhost:3306/test?useSSL=false";
        String username="root";
        String password="root";
        Connection connection = DriverManager.getConnection(url, username, password);
        Statement statement = connection.createStatement();
        String sql ="SELECT id , username FROM `user`";
        ResultSet set = statement.executeQuery(sql);
        while (set.next()) {
//            int string = set.getInt(1);
//            String string1 = set.getString(2);
//            System.out.println(string + " " + string1);
            System.out.println(set.getInt(1)+" "+set.getString(2));
        }


    }
}
